package com.yunkaweilai.android.view.dialog.guadan;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.view.View;
import android.widget.TextView;

import com.flyco.dialog.utils.CornerUtils;
import com.flyco.dialog.widget.base.BaseDialog;
import com.yunkaweilai.android.R;
import com.yunkaweilai.android.activity.operation.consumption.guadan.GuadanListActivity;
import com.yunkaweilai.android.activity.operation.consumption.shops.ConfirmShopListActivity;
import com.yunkaweilai.android.activity.operation.consumption.shops.ShopConsumptionActivity;
import com.yunkaweilai.android.base.BaseApplication;

/**
 * 挂单成功
 * Created by Administrator on 2016/12/22 0022.
 */

public class GuadanSuccessDialog extends BaseDialog<GuadanSuccessDialog> {
    TextView idTvRight;
    private Context context;
    private TextView idTvContent;
    private String gid;
    private TextView idTvCardNo;
    private TextView idTvClose;

    public GuadanSuccessDialog(Context context,String gid) {
        super(context);
        this.context = context;
        this.gid = gid;
    }

    @Override
    public View onCreateView() {
        widthScale(0);
        //showAnim(new Swing());
        //dismissAnim(this, new ZoomOutExit());
        View inflate = View.inflate(mContext, R.layout.dialog_guadan_success, null);
        idTvRight = (TextView) inflate.findViewById(R.id.id_tv_right);
        idTvCardNo = ((TextView) inflate.findViewById(R.id.id_tv_order_no));
        idTvClose = ((TextView) inflate.findViewById(R.id.id_tv_close));
        idTvCardNo.setText("挂单号：" + gid);
        //设置背景颜色，和背景的透明圆弧角度
        inflate.setBackgroundDrawable(
                CornerUtils.cornerDrawable(Color.parseColor("#f8f9fa"), dp2px(10)));

        return inflate;
    }

    @Override
    public void setUiBeforShow() {
        idTvRight.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ((ConfirmShopListActivity)context).finish();
                BaseApplication.getSelectedMaps().clear();
                context.startActivity(new Intent(context, ShopConsumptionActivity.class));
            }
        });
        idTvClose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                ((ConfirmShopListActivity)context).finish();
                BaseApplication.getSelectedMaps().clear();
                context.startActivity(new Intent(context, GuadanListActivity.class));
            }
        });
    }
}
